#ifndef _SYS_LOG_H_
#define _SYS_LOG_H_

#include "FanObj.h"
#include "SysTypes.h"

#define LOG_VTABLE(self)   ((LogVTable*)((FanObj*)self)->vtable)


extern Type*    Log_classType;
extern VTable*  Log_classVTable;


/* [sys::Log] Attributes */
struct Log
{
  FanObj        super;
};


/* [sys::Log] Virtual-table */
typedef struct LogVTable
{
  FanObjVTable  super;
  void          (*log)(Log* self, LogRec* rec);
} LogVTable;


/* [sys::Log] Methods and fields */
void            Log_make(Log* self, Str* name, Bool reg);
Str*            Log_toStr(Obj self);
LogLevel*       Log_level(Log* self);
void            Log_setLevel(Log* self, LogLevel* val);
List*           Log_list(void);
Log*            Log_find_1(Str* name);
Log*            Log_find(Str* name, Bool checked);
Log*            Log_get(Str* name);
Str*            Log_name(Log* self);
Bool            Log_isEnabled(Log* self, LogLevel* level);
Bool            Log_isErr(Log* self);
Bool            Log_isWarn(Log* self);
Bool            Log_isInfo(Log* self);
Bool            Log_isDebug(Log* self);
void            Log_err_1(Log* self, Str* msg);
void            Log_err(Log* self, Str* msg, Err* err);
void            Log_warn_1(Log* self, Str* msg);
void            Log_warn(Log* self, Str* msg, Err* err);
void            Log_info_1(Log* self, Str* msg);
void            Log_info(Log* self, Str* msg, Err* err);
void            Log_debug_1(Log* self, Str* msg);
void            Log_debug(Log* self, Str* msg, Err* err);
void            Log_log(Log* self, LogRec* rec);
List*           Log_handlers(void);
void            Log_addHandler(Func* handler);
void            Log_removeHandler(Func* handler);


/* [sys::Log] Type-system functions */
Type*           Log_initType(void);
VTable*         Log_initVTable(void);
void            Log_initStatic(void);


#endif
